﻿using System;
using System.Runtime.Serialization;
using NCMIS.ObjectModel.MetaData;

namespace NCMIS.Produce
{
    /// <summary>
    /// Represents the capabilities of a repository. Each boolean class member represent an optional capability,
    /// meaning the repository does not need to support the specific capability to be compliant with CMIS.
    /// </summary>
    [DataContract(Namespace = CmisNs.Cmis)]
    public class RepositoryCapabilities
    {
        #region Navigation Capabilities

        /// <summary>
        /// Specifies whether the repository allows the enumeration of the descendants of a folder via the <code>GetDescendants</code>
        /// service method of <see cref="NCMIS.ServiceModel.Ra.NavigationService"/>.
        /// </summary>
        [DataMember(Name = "capabilityGetDescendants")]
        public bool GetDescendants
        {
            get;
            set;
        }

        /// <summary>
        /// Specifies whether the repository allows the retrievment of the folder tree via the <code>GetFolderTree</code> service
        /// method of <see cref="NCMIS.ServiceModel.Ra.NavigationService"/>.
        /// </summary>
        [DataMember(Name = "capabilityGetFolderTree")]
        public bool GetFolderTree
        {
            get;
            set;
        }

        #endregion

        #region Object Capabilities

        /// <summary>
        /// Indicates a repository's support for updating a document's content stream.
        /// </summary>
        [DataMember(Name = "capabilityContentStreamUpdatability")]
        public CapabilityContentStreamUpdates ContentStreamUpdatability
        {
            get;
            set;
        }

        /// <summary>
        /// Indicates what level of changes the repository exposes via the <code>GetContentChanges</code> service method of
        /// <see cref="NCMIS.ServiceModel.Ra.DiscoveryService"/>.
        /// </summary>
        [DataMember(Name = "capabilityChanges")]
        public CapabilityChanges Changes
        {
            get;
            set;
        }

        /// <summary>
        /// Indicates whether a repository exposes renditions of document objects.
        /// </summary>
        [DataMember(Name = "capabilityRenditions")]
        public CapabilityRendition Renditions
        {
            get;
            set;
        }

        #endregion

        #region Filing Capabilities

        /// <summary>
        /// Indiciates a repository's ability to file a document, or other fileable object, in multiple folders.
        /// </summary>
        [DataMember(Name = "capabilityMultifiling")]
        public bool Multifiling
        {
            get;
            set;
        }

        /// <summary>
        /// Indicates a repository's ability to leave a document, or other fileable object, non-filed in any folder.
        /// </summary>
        [DataMember(Name = "capabilityUnfiling")]
        public bool Unfiling
        {
            get;
            set;
        }

        /// <summary>
        /// Indicates a repository's ability to file indivdual versions (i.e. not all versions) of a document in a folder.
        /// </summary>
        [DataMember(Name = "capabilityVersionSpecificFiling")]
        public bool VersionSpecificFiling
        {
            get;
            set;
        }

        #endregion

        #region Versioning Capabilities

        /// <summary>
        /// Indicates a repository's capability to update the "Private Working Copy" of a checked-out document.
        /// </summary>
        [DataMember(Name = "capabilityPWCUpdatable")]
        public bool PwcUpdatable
        {
            get;
            set;
        }

        /// <summary>
        /// Indiciates a repository's ability to include the "Private Working Copy" of a checked-out document in a query search scope.
        /// If not, PWC's are not searchable.
        /// </summary>
        [DataMember(Name = "capabilityPWCSearchable")]
        public bool PwcSearchable
        {
            get;
            set;
        }

        /// <summary>
        /// Indiciates a repository's ability to include non-latest versions of document in query search scope. If not only the
        /// latest version of each document is searchable.
        /// </summary>
        [DataMember(Name = "capabilityAllVersionsSearchable")]
        public bool AllVersionsSearchable
        {
            get;
            set;
        }

        #endregion

        #region Query Capabilities

        /// <summary>
        /// Indiciates the types of queries that the repository supports.
        /// </summary>
        [DataMember(Name = "capabilityQuery")]
        public CapabilityQuery Query
        {
            get;
            set;
        }

        /// <summary>
        /// Indicates the types of JOIN keywords that the repository supports in queries.
        /// </summary>
        [DataMember(Name = "capabilityJoin")]
        public CapabilityJoin Join
        {
            get;
            set;
        }

        #endregion

        #region ACL Capabilities

        /// <summary>
        /// Indicates a repository's level of support for ACLs.
        /// </summary>
        [DataMember(Name = "capabilityACL")]
        public CapabilityAcl Acl
        {
            get;
            set;
        }

        #endregion
    }
}
